<?php

namespace Application\Model\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Utilisateur
 *
 * @ORM\Table(name="utilisateur", indexes={@ORM\Index(name="FK_Utilisateur_Boutique", columns={"id_boutique"})})
 * @ORM\Entity
 */
class Utilisateur
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var boolean
     *
     * @ORM\Column(name="est_admin", type="boolean", nullable=true)
     */
    private $estAdmin;

    /**
     * @var string
     *
     * @ORM\Column(name="nom", type="string", length=30, nullable=true)
     */
    private $nom;

    /**
     * @var string
     *
     * @ORM\Column(name="prenom", type="string", length=30, nullable=true)
     */
    private $prenom;

    /**
     * @var string
     *
     * @ORM\Column(name="mail", type="string", length=30, nullable=true)
     */
    private $mail;

    /**
     * @var string
     *
     * @ORM\Column(name="login", type="string", length=30, nullable=true)
     */
    private $login;

    /**
     * @var string
     *
     * @ORM\Column(name="password", type="string", length=10, nullable=true)
     */
    private $password;

    /**
     * @var \Application\Model\Entity\Boutique
     *
     * @ORM\OneToOne(targetEntity="Application\Model\Entity\Boutique", cascade={"persist", "merge"})
     * @ORM\JoinColumn(name="id_boutique", referencedColumnName="id")
     */
    private $boutique;

    /**
     * Constructor
     */
    public function __construct($id = null, $estAdmin = null, $nom = null, $prenom = null, $mail = null, 
            $login = null, $password = null, $boutique = null)
    {
        $this->id = $id;
        $this->estAdmin = $estAdmin;
        $this->nom = $nom;
        $this->prenom = $prenom;
        $this->mail = $mail;
        $this->login = $login;
        $this->password = $password;
        $this->boutique = $boutique;
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set estAdmin
     *
     * @param boolean $estAdmin
     * @return Utilisateur
     */
    public function setEstAdmin($estAdmin)
    {
        $this->estAdmin = $estAdmin;

        return $this;
    }

    /**
     * Get estAdmin
     *
     * @return boolean 
     */
    public function getEstAdmin()
    {
        return $this->estAdmin;
    }

    /**
     * Set nom
     *
     * @param string $nom
     * @return Utilisateur
     */
    public function setNom($nom)
    {
        $this->nom = $nom;

        return $this;
    }

    /**
     * Get nom
     *
     * @return string 
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set prenom
     *
     * @param string $prenom
     * @return Utilisateur
     */
    public function setPrenom($prenom)
    {
        $this->prenom = $prenom;

        return $this;
    }

    /**
     * Get prenom
     *
     * @return string 
     */
    public function getPrenom()
    {
        return $this->prenom;
    }

    /**
     * Set mail
     *
     * @param string $mail
     * @return Utilisateur
     */
    public function setMail($mail)
    {
        $this->mail = $mail;

        return $this;
    }

    /**
     * Get mail
     *
     * @return string 
     */
    public function getMail()
    {
        return $this->mail;
    }

    /**
     * Set login
     *
     * @param string $login
     * @return Utilisateur
     */
    public function setLogin($login)
    {
        $this->login = $login;

        return $this;
    }

    /**
     * Get login
     *
     * @return string 
     */
    public function getLogin()
    {
        return $this->login;
    }

    /**
     * Set password
     *
     * @param string $password
     * @return Utilisateur
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Get password
     *
     * @return string 
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set boutique
     *
     * @param \Application\Model\Entity\Boutique $boutique
     * @return Utilisateur
     */
    public function setBoutique(\Application\Model\Entity\Boutique $boutique = null)
    {
        $this->boutique = $boutique;

        return $this;
    }

    /**
     * Get boutique
     *
     * @return \Application\Model\Entity\Boutique 
     */
    public function getBoutique()
    {
        return $this->boutique;
    }
    
    function exchangeArray($data)
    {
        $this->nom = (isset($data['name'])) ? $data['name'] : null;
        $this->mail = (isset($data['email'])) ? $data['email'] : null;
        
        if (isset($data["password"]))
        {
            $this->setPassword($data["password"]);
        }
    }
}
